<? session_start();
class dbClass{
public function connect(){
		$myhost="localhost";
		$myuser="root";
		$mypass="";
		$mydb="elearning";	
	     /* Connecting, selecting database */
	     mysql_connect($myhost, $myuser, $mypass)
		 or die("Could not connect : " . mysql_error());
	     /*print "Connected successfully";*/
	     mysql_select_db($mydb) or die("Could not select database");
		}
public function titlePage() {
	echo 'Panghulo National Highschool';
}

public function forum(){
	//melai lgyan mo toh design
$queryHome = mysql_query("SELECT * FROM tblfrtopic WHERE views != 0");
		$noOfTopic = mysql_num_rows($queryHome);
		$loop = 1;
		$ctr = 1;
		
		while($ctr <= $noOfTopic){
		
		while($row_topic = mysql_fetch_assoc($queryHome)):
	
		$title	 = $row_topic['topictitle'];
		$content = $row_topic['topicontent'];
		$date 	 = $row_topic['topicdate'];
		$categ 	 = $row_topic['category'];
		
		echo ($title);
		echo ($content);
		echo ($date);
		echo ($categ);
		$loop++;
		endwhile;
		$ctr++;
		}
}


public function about(){
	//melai lgyan mo toh design
$queryAbout = mysql_query("SELECT * FROM tblcms WHERE cmsType = 'about' AND cmsStatus = 'on'");
		$noOfAbout = mysql_num_rows($queryAbout);
		$loop = 1;
		$ctr = 1;
		
		while($ctr <= $noOfAbout){
		
		while($row_about = mysql_fetch_assoc($queryAbout)):
			$title 		= $row_about['cmsTitle'];
			$content 	= $row_about['cmsContent'];
		
		echo ($title);
		echo ($content);

		$loop++;
		endwhile;
		$ctr++;
		}
}
public function annouce(){
	//melai lgyan mo toh design
$queryAnnouce = mysql_query("SELECT * FROM tblcms WHERE cmsType = 'annouce' AND cmsStatus = 'on'");
		$noOfAnnouce = mysql_num_rows($queryAnnouce);
		$loop = 1;
		$ctr = 1;
		
		while($ctr <= $noOfAnnouce){
		
		while($row_annouce = mysql_fetch_assoc($queryAnnouce)):
			$title 		= $row_annouce['cmsTitle'];
			$content 	= $row_annouce['cmsContent'];
		
		echo ($title);
		echo ($content);

		$loop++;
		endwhile;
		$ctr++;
		}
}
public function contact(){
	//melai lgyan mo toh design
$queryContact = mysql_query("SELECT * FROM tblcms WHERE cmsType = 'contact' AND cmsStatus = 'on'");
		$noOfAnnouce = mysql_num_rows($queryContact);
		$loop = 1;
		$ctr = 1;
		
		while($ctr <= $noOfAnnouce){
		
		while($row_contact = mysql_fetch_assoc($queryContact)):
			$title 		= $row_contact['cmsTitle'];
			$content 	= $row_contact['cmsContent'];
		
		echo ($title);
		echo ($content);

		$loop++;
		endwhile;
		$ctr++;
		}
}
public function home(){
	//melai lgyan mo toh design
$queryHome = mysql_query("SELECT * FROM tblcms WHERE cmsType = 'home' AND cmsStatus = 'on'");
		$noOfHome = mysql_num_rows($queryHome);
		$loop = 1;
		$ctr = 1;
		
		while($ctr <= $noOfHome){
		
		while($row_home = mysql_fetch_assoc($queryHome)):
			$title 		= $row_home['cmsTitle'];
			$content 	= $row_home['cmsContent'];
		
		echo ($title);
		echo ($content);

		$loop++;
		endwhile;
		$ctr++;
		}
}
}
?>